package day11.demo;

/**
 * @Author juzipi
 * @Date 2021/6/28 9:17
 * @Info
 */
public class InstanceTest {
    //通过子类的构造器创建子类对象时，一定会直接或间接的调用父类的构造器，进而调用父类的父类的构造器...
    //直到Object类的空参构造为止，

    //虽然创建子类对象时，调用了父类的构造器，但是自始至终就创建过一个对象，就是new的子类对象

    public static void main(String[] args) {
        Account account = new Account(1,1245.5);
        account.withdraw(10000);
        System.out.println("余额:"+account.getBalance());
        account.deposit(10000);
        System.out.println("余额:"+account.getBalance());
        System.out.println("年利率"+account.getAnnualInterestRate());
    }


}
